package cn.dapeng.designPatterns.chain.t02;

public class TestCase {

    public static void main(String[] args) {
        Product[] products = {new Product(30, 60), new Product(60, 30), new Product(50, 70), new Product(70, 50)};
        ProcessorChain chain = new ProcessorChain();
        chain.addProcessor(new LengthProcessor()).addProcessor(new WidthProcessor());
        for (Product product : products) {
            boolean check = chain.doFilter(product, chain);
            if (check) {
                System.out.println(product + ", 产品最终检验合格");
            } else {
                System.out.println(product + ", 产品最终检验不合格");
            }
            System.out.println();
        }
    }
}
